<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<html>
<head>
    <title>Title</title>
    <script src="${pageContext.request.contextPath}/js/jquery-2.1.0.js"></script>
    <!--bootstrap.min.css-->
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/userLogin/bootstrap.min.css">
    <script type="text/javascript">
        $(function () {
            $("body").on("click","#re",function() {
                var formData = new FormData();

                formData.append("usersName", $("#usersName").val());
                formData.append("password", $("#password").val());
                formData.append("protrait", $("#protrait").val());
                formData.append("phone", $("#phone").val());
                formData.append("usersEmail", $("#usersEmail").val());
                formData.append("likeType", $("#likeType").val());

                $.ajax({
                    type:"post",
                    url:"${pageContext.request.contextPath }/user/toRegister",
                    dataType:"text",
                    data:formData,
                    success:function(data){
                        if (data==1) {
                            alert("添加成功");
                            location.href="${pageContext.request.contextPath}/userLogin";
                        }
                    }, error:function(){
                        alert("系统崩溃！");
                        location.href="${pageContext.request.contextPath}/register";
                    }

                });
            })
        })
    </script>
</head>
<body>

<div class="container-fluid" >
    <div class="row">
        <div class="col-lg-4" style="padding: 0px">
            <img src="${pageContext.request.contextPath }/img/jay_chou.png" width="640px">
        </div>
        <div class="col-lg-7">
            <jsp:useBean id="user" class="com.mc.music_web.entity.User" scope="request"/>
            <div style="border: 1px solid white;margin-left: 650px;">
                <div style="float: left; width: 60px;height: 60px; margin-top: 12px;"> <a href="${pageContext.request.contextPath}/toChineseR?locale=zh_CN"><img src="${pageContext.request.contextPath}/img/CH.ico" width="40" height="40" STYLE="padding-bottom: 8px">&nbsp;&nbsp;CH</a></div>
                <div style="float: left; margin-top: 7px;width: 60px;height: 60px;"> <a href="${pageContext.request.contextPath}/toEnglishR?locale=en_US"><img src="${pageContext.request.contextPath}/img/USA.ico" width="46" height="46">USA</a></div>
            </div>




            <form:form modelAttribute="user" action="${pageContext.request.contextPath}/user/register" enctype="multipart/form-data" method="post">
                <div class="container-fluid" >
                    <div class="row">
                        <div class="col-lg-12">
                            <div style="text-align: center"><h2><spring:message code="userNameResgier"/></h2></div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-lg-4">&nbsp;</div>
                        <div class="col-lg-8" >
                            <div style="text-align: left;line-height: 30px;font-size: 20px;color: grey"> <spring:message code="userName"/></div>
                            <div style="text-align: center"><form:input cssClass="form-control" cssStyle="width: 400px;height: 40px" path="usersName" name="usersName" id="usersName"/><form:errors path="usersName"/></div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-lg-4">&nbsp;</div>
                        <div class="col-lg-8" >
                            <div style="text-align: left;line-height: 30px;font-size: 20px;color: grey"> <spring:message code="uPassword"/></div>
                            <div style="text-align: center"><form:password cssClass="form-control" cssStyle="width: 400px;height: 40px"  path="password" name="password" id="password"/><form:errors path="password"/></div>
                        </div>
                    </div>

                    <div class="row">
                        <div class="col-lg-4">&nbsp;</div>
                        <div class="col-lg-8" >
                            <div style="text-align: left;line-height: 30px;font-size: 20px;color: grey"> <spring:message code="phont"/></div>
                            <div style="text-align: center"><form:input cssClass="form-control" cssStyle="width: 400px;height: 40px" path="protrait" name="protrait" id="protrait"/><form:errors path="protrait"/></div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-lg-4">&nbsp;</div>
                        <div class="col-lg-8" >
                            <div style="text-align: left;line-height: 30px;font-size: 20px;color: grey"> <spring:message code="uPhone"/></div>
                            <div style="text-align: center"><form:input cssClass="form-control" cssStyle="width: 400px;height: 40px"  path="phone" id="phone"/><form:errors path="phone"/></div>
                        </div>
                    </div>

                    <div class="row">
                        <div class="col-lg-4">&nbsp;</div>
                        <div class="col-lg-8" >
                            <div style="text-align: left;line-height: 30px;font-size: 20px;color: grey"> <spring:message code="uEmail"/></div>
                            <div style="text-align: center"><form:input cssClass="form-control" cssStyle="width: 400px;height: 40px" path="usersEmail" id="usersEmail"/><form:errors path="usersEmail"/></div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-lg-4">&nbsp;</div>
                        <div class="col-lg-8" >
                            <div style="text-align: left;line-height: 30px;font-size: 20px;color: grey"> <spring:message code="likeType"/></div>
                            <div style="text-align: center"><form:input cssClass="form-control" cssStyle="width: 400px;height: 40px" path="likeType" id="likeType"/><form:errors path="likeType"/></div>
                        </div>
                    </div>
                    <div style="text-align: center;margin-top: 20px;margin-left: 70px"><input class="btn btn-primary" style="width: 200px;height: 40px;padding: 5px;font-size: 20px" type="submit" id="re" value="<spring:message code="addUser"/>"/></div>
                </div>
                <input type="hidden" name="userId" id="userId"/>





            </form:form>
        </div>
    </div>
</div>


</body>
</html>
